
module.exports = function(app) {
    return new chatRemote(app);
};
var chatRemote = function(app) {
    this.app = app;
    this.channelService = app.get("channelService");
};
// 加入聊天
chatRemote.prototype.enterChannel = function(uid, sid , cb) {   
    console.log("chatRemote.prototype.enterChannel") ;   
    var channel = this.channelService.getChannel("chatworld", true);
    channel.add(uid, sid);
    cb();
};
// 退出聊天
chatRemote.prototype.exitChannel = function(uid, sid , cb) {  
    console.log("chatRemote.prototype.exitChannel") ; 
    var channel = this.channelService.getChannel("chatworld", true);
    if (!!channel) {
        console.log("channel leave", uid, sid);
        console.log(channel.leave(uid, sid));
        console.log(channel.getUserAmount());
    }
    if (cb) {
        cb();
    }
};